import CryptoJS from "crypto-js";
//随机生成指定数量的32进制key
export default {
  //解密
  decrypt(word, keyStr) {
    keyStr = keyStr ? keyStr : "1234567890122222";
    word = (word + '').replace(/\n*$/g, '').replace(/\n/g, '');
    let key = CryptoJS.enc.Utf8.parse(keyStr);
    let decrypt = CryptoJS.AES.decrypt(word, key, {
        mode: CryptoJS.mode.ECB,
        padding: CryptoJS.pad.Pkcs7
    });
    return decrypt.toString(CryptoJS.enc.Utf8)
  }
};
